// 平台管理接口
import axios from '../interceptors.js'

// 工作流情况
export const getWorkflowData = (data) => {
  return axios({
    url: '/pipeline/pipelines/num',
    method: 'get',
    params: data
  })
}

// 图谱情况
export const getAltasData = (data) => {
  return axios({
    url: '/pipeline/instance/all/get/num',
    method: 'get',
    params: data
  })
}

// 用户情况
export const getUserData = (data) => {
  return axios({
    url: '/user/account/statistics',
    method: 'get',
    params: data
  })
}

// 数据集情况
export const getDatasData = (data) => {
  return axios({
    url: '/pipeline/dataset/num',
    method: 'get',
    params: data
  })
}

// 工作流配置的接口↓↓↓↓

// 数据-树分类
export const getCategories = () => {
  return axios({
    url: '/pipeline/task-categories'
  })
}

// 任务镜像类型
export const getImageTypes = () => {
  return axios({
    url: '/pipeline/task-types',
    timeout: 600000000
  })
};

// 新增类型
export const addCategory = (data) => {
  return axios({
    url: '/pipeline/task-categories',
    method: 'POST',
    data
  })
}

// 编辑类型
export const editCategory = (data) => {
  return axios({
    url: '/pipeline/task-categories',
    method: 'PUT',
    data
  })
}

// 新增类型
export const delCategory = (data) => {
  return axios({
    url: `/pipeline/task-categories/${data.id}`,
    method: 'DELETE'
  })
}

// 3.2获取节点详情
export const getNodeDetail = (data) => {
  return axios({
    url: `/pipeline/task-nodes/${data.id}`,
    method: 'GET'
  })
}

// 3.3新增节点
export const addNode = (data) => {
  return axios({
    url: `/pipeline/task-nodes`,
    method: 'POST',
    data
  })
}

// 3.4 编辑节点
export const editNode = (data) => {
  return axios({
    url: `/pipeline/task-nodes`,
    method: 'PUT',
    data
  })
}

// 3.5 删除节点
export const delNode = (data) => {
  return axios({
    url: `/pipeline/task-nodes/${data.id}`,
    method: 'DELETE'
  })
}
